let net = require('net')
let server = net.createServer(connectionListener)

/**
 * req和res都是从socket来的
 * 先监听socket的data事件，等事件发生的时候解析
 * 3，http客户端
 * 压缩和解压缩
 */


function connectionListener(socket){
    socket.on('data', function(){
        let {req, res} = parse(socket, data)
        this.emit('request', req, res)
    })
}
function parse(socket, data){
    let req = {}
    
    let res = {}
    return {req, res}
}
server.on('request', function(req, res){
    req.headers;
    res.write()
})


server.listen(8080)


